<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
Route::namespace('v1')->prefix('v1')->middleware(['api.auth','validate','jwt.refresh'])->group(function (){
    Route::post('logout','AuthController@logout');
    Route::get('user/info','UserController@info');
});

Route::namespace('v1')->prefix('v1')->middleware(['validate'])->group(function (){
    Route::post('login','AuthController@login');
    Route::post('register','AuthController@register');
    Route::get('auth/{service}', 'AuthController@redirectToProvider');
    Route::get('auth/{service}/callback', 'AuthController@handleProviderCallback');
});


/**
 * admin路由表
 */
Route::namespace('admin')->prefix('admin')->middleware(['admin.auth','validate'])->group(function (){
    Route::get('info','AdminController@info');
    Route::post('logout','AuthController@logout');
});
Route::namespace('admin')->prefix('admin')->middleware(['validate'])->group(function (){
    Route::post('login','AuthController@login');
});